home *** CD-ROM | disk | FTP | other *** search
/ AMIGA-CD 2 / Amiga-CD - Volume 2.iso / ungepackte_daten / 1994 / 6 / 01 / mini-compiler / mini.ampk / Mini-Compiler / TDS / src / print.c < prev   
Encoding:
C/C++ Source or Header  |  1995-06-01  |  317 b   |  27 lines

  1. /* print.c */
  2.  
  3. #include <stdio.h>
  4. #include <string.h>
  5.  
  6. int
  7. print(char *name)
  8. {
  9. FILE *fp;
  10. char line[256];
  11. int count;
  12.  
  13.   fp = fopen(name,"r");
  14.   if (fp) {
  15.     count = 1;
  16.     while (fgets(line,256,fp)) {
  17.       printf("%4d %s",count,line);
  18.       count++;
  19.     }
  20.     fclose(fp);
  21.     return(1);
  22.   }
  23.   else
  24.     return(0);
  25. }
  26.  
  27.